<include file="Public:header" />
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/static/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript">
    <!--
    KindEditor.ready(function(K) {
        var detaileditor;
        detaileditor = K.create('#content', {
            newlineTag : 'br'
        });
    });
    $(function(){
        $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
        $("#catid").formValidator({onshow:"请选择信息分类",onfocus:"请选择信息分类",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请选择信息分类"});
        $("#title").formValidator({onshow:"请输入标题",onfocus:"请输入标题",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入标题"});
        $("#uid").formValidator({onshow:"请输入会员ID",onfocus:"会员ID应该为大于等于0的整数"}).inputValidator({max:5,onerror:"会员ID应该为大于等于0的整数"}).regexValidator({regexp:"num1",datatype:"enum",param:'i',onerror:"会员ID应该为大于等于0的整数"});
        //$("#linkurl").formValidator({empty:true,onshow:"请填写链接URL",onfocus:"请填写链接URL"}).inputValidator({onerror:"请填写链接URL"}).regexValidator({regexp:"url",datatype:"enum",param:'i',onerror:"链接URL格式错误"});
    })
    function delPic(obj) {
        var src = $('#picurl').val();
        $.get("__APP__?m=Article&a=delpic&picurl="+src);
        $('#picshow').html('');
        $('#picurl').val('');
    }
    //-->
</script>
<div class="common-form">
    <div style="clear:both;"><a href="{:U('Article/index')}" class="navbtn">返回{$modulename}管理</a></div>
    <form name="myform" id="myform" action="{:U('Article/insert')}" method="post">
        <input type="hidden" name="status" value="1">
        <input type="hidden" name="picurl" id="picurl" value="">
        <table width="100%" class="table_form contentWrap">
            <tr>
                <td align="right" width="80">文章标题：</td>
                <td align='left'><input type="text" name="title" id="title" onkeyup="checkLen(this,{$CFG.cell_titlelen},'titlelen');" onchange="checkLen(this,{$CFG.cell_titlelen},'titlelen');" size="60">
                    {:show_style('toptitle')} 不能超过{$CFG.cell_titlelen}个字符，还可以输入 <span id="titlelen" class="red">{$CFG.cell_titlelen}</span> 字
                </td>
            </tr>
            <tr>
                <td align="right">文章摘要：</td>
                <td align='left' id="td_txt">
                    <div style="width: 500px;height: 190px;float: left;">
                        <textarea name='summary' id='summary' style="width:480px;height:140px;" onchange="checkLen(this,{$CFG.cell_contentlen},'contentlen');" onkeyup="checkLen(this,{$CFG.cell_contentlen},'contentlen');"></textarea>
                        <br>不能超过{$CFG.cell_contentlen}个字符，还可以输入 <span id="contentlen" class="red">{$CFG.cell_contentlen}</span> 字
                    </div>

                    <div style="width: 200px;height: 190px;float: left;">
                        <div class="waitpic cu" style="width:{$CFG['cell_width'][0]}px;height:{$CFG.cell_height}px;" onclick="if($('#picurl').val()!=''){preview($('#picurl').val());return false;}doDialog('{:U(\'Article/upload\')}','上传图片','320','100');">
                            <span id="picshow"></span>
                        </div>
                        <div style="width:{$CFG['cell_width'][0]}px;text-align:center;">
                            <span onclick="doDialog('{:U(\'Article/upload\')}','上传图片','320','100')" class="cu"><img src="__PUBLIC__/Admin/Images/icon/img_upload.gif" title="上传"/></span>&nbsp;&nbsp;
                            <span onclick="delPic();" class="cu"><img src="__PUBLIC__/Admin/Images/icon/img_delete.gif" width="12" height="12" title="删除"/></span>
                        </div>
                        图片 （图片宽高：<span class="red">{$CFG['cell_width'][0]} X {$CFG.cell_height}</span> px，超过此宽度或高度将被自动裁剪。）
                    </div>
                </td>
            </tr>
            <tr>
                <td align="right">文章内容：</td>
                <td align='left'><textarea name='content' id='content' style='height:400px;width:700px;'></textarea></td>
            </tr>
            <tr>
                <td align="right">文章分类：</td>
                <td align='left'>
                    <select name="catid" id='catid'>
                        <option value="0" selected>--选择分类--</option>
                        <volist name="CATEGORY" id="vo">
                            <option value="{$vo.id}">{$vo.catname}</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>
                <td align="right">标签：</td>
                <td align='left'><input type="text" name="tags" maxlength='54' size="60"> 多个标签用空格分开（暂不支持逗号）</td>
            </tr>
            <tr>
                <td align="right"></td>
                <td align='left'><input type="submit" id="dosubmit" class="button" name="dosubmit" value=" 提 交 "/></td>
            </tr>
        </table>
        <div class="bk15"></div>
    </form>
</div>